﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using HWmanagementClient.HWManager;

namespace HWmanagementClient.Models
{
    public class SubjectClientModel
    {
        public string neptun { get; set; }
        public string name { get; set; }
        public List<UserModel> teachers { get; set; }
        public List<CourseModel> courses { get; set; }

        public static SubjectClientModel fromWCFmodel(SubjectModel m)
        {
            return new SubjectClientModel()
            {
                name = m.name,
                neptun = m.neptun
            };
        }
    }

    public class FileClientModel
    {
        public string fileurl { get; set; }
        public string filename { get; set; }
        public int last { get; set; }

        public static FileClientModel fromWCFmodel(FileModel m)
        {
            return new FileClientModel()
            {
                filename = m.name.Split(new[] { '\\'}).Last(),
                fileurl = m.name,
                last = 0
            };
        }

        public static FileClientModel fromWCFmodel(FileModel m, FileModel lastversion)
        {
            return new FileClientModel()
            {
                filename = m.name.Split(new[] { '\\' }).Last(),
                fileurl = m.name,
                last = m.id == lastversion.id ? 1 : 0
            };
        }
    }

    public class TeacherHomeworks
    {
        public List<HomeworkClientModel> Homeworks { get; set; }
        public HomeworkClientModel newhw { get; set; }
        public List<SubjectClientModel> Subjects { get; set; }
        public List<SubjectClientModel> allSubject { get; set; }
        public List<UserModel> users { get; set; }
        public ResultModel newresult { get; set; }
        public List<FileClientModel> files { get; set; }
    }
}